#!/bin/bash
#
# bansshd		This shell script takes care of starting and stopping
#		bansshd (banssh daemon).
#
# chkconfig: - 88 74
# description: banssh is the banssh daemon. \
# The Network Time Protocol (NTP) is used to synchronize the time of \
# a computer banssh_clientd or server to another server or reference time source, \
# such as a radio or satellite receiver or modem.

### BEGIN INIT INFO
# Provides: banssh
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Should-Start: $syslog $named bansshate
# Should-Stop: $syslog $named
# Short-Description: start and stop banssh
# Description: banssh is the banssh daemon. 
#              
#              
#              
### END INIT INFO

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

prog=bheartbeat
lockfile=/var/lock/subsys/$prog

# For SELinux we need to use 'runuser' not 'su'
if [ -x "/sbin/runuser" ]; then
    SU="/sbin/runuser"
else
    SU="su"
fi

# Define the banssh username
#BANSSH_USER="${BANSSH_USER:-banssh}"

# Define the bansshs group
#BANSSH_GROUP="${BANSSH_GROUP:-bansshs}"





start() {
	# Check that networking is up.
	#[ "$NETWORKING" = "no" ] && exit 1

        # You need to fix this to make it more general
	[ -x /sbin/$prog ] || exit 5

	[ -x /sbin/audisp-bot ] || exit 6


        # Start daemons.
        echo -n $"Starting $prog: "
        cd /sbin
        daemon $prog
	RETVAL=$?
        #rdate -s time-b.nist.gov
        echo
	[ $RETVAL -eq 0 ] && touch $lockfile
	return $RETVAL
}

stop() {
        echo -n $"Shutting down $prog: "
	killproc $prog
	RETVAL=$?
        echo
	[ $RETVAL -eq 0 ] && rm -f $lockfile
	return $RETVAL
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
	status $prog
	;;
  restart|force-reload)
	stop
	start
	;;
  try-restart|condrestart)
	if [ -f $lockfile ]; then
	    stop
	    start
	fi
	;;
  reload)
	exit 3
	;;
  *)
	echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
	exit 2
esac
